package com.example.androideventdistribution.page1

import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.example.androideventdistribution.R

/**
 * Created by YuanWei1 on 2024/6/7.
 *
 * Description:
 */
class InnerRecyclerViewAdapter(list: List<String>) : RecyclerView.Adapter<InnerRecyclerViewAdapter.ViewHolder>() {
    private val list: List<String> = list

    class ViewHolder(view: View) : RecyclerView.ViewHolder(view) {
        var mName: TextView = view.findViewById(R.id.mName)
    }

    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
        val view: View = LayoutInflater.from(parent.context).inflate(R.layout.item_inner, parent, false)
        return ViewHolder(view)
    }

    override fun onBindViewHolder(holder: ViewHolder, position: Int) {
        holder.mName.text = list[position]

    }

    override fun getItemCount(): Int {
        return list.size
    }
}
